[mirrors]
http://ffmpeg.org/releases/ffmpeg-3.0.2.tar.xz

[vars]
filesize=7461808
sha512=a784258412431ef867372d24873f14d25cdbf333425b700f6836810c250a9d8811398de31dd042031c48e409659881bf6f6d6bfa46d74e3146536274d5186a22

[deps]
alsa-lib
libvorbis
libflac

[deps.host]
bash

[build]
[ -z "$butch_prefix" ] && butch_prefix=/
sed -i 's@/bin/sh@/bin/bash@' configure

[ -n "$CROSS_COMPILE" ] && xconfflags="--enable-cross-compile --target-os=linux --arch=$A"

testlib() {
	printf "int main() {}\n" > test_lib.c
	$CC test_lib.c -l$1 >/dev/null 2>&1
}

libvpx=
testlib vpx && libvpx=--enable-libvpx
libv4l2=
testlib v4l2 && libv4l2=--enable-libv4l2
libx11=
testlib X11 && libx11=--enable-x11grab

CFLAGS="-D_BSD_SOURCE $optcflags" LDFLAGS="$optldflags" \
  ./configure --prefix="$butch_prefix" --disable-debug --disable-yasm \
  --cc="$CC" --cxx="$CXX" --host-cc="$HOSTCC" $xconfflags \
  --enable-shared --enable-postproc --enable-gpl $libvpx $libv4l2 $libx11 \
  --enable-libvorbis \
  --disable-stripping 
  
make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install
